﻿<%@ Page Title="ХочуБукет.RU - Корзина" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="Cart.aspx.cs" Inherits="FlowersStore.Cart" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <tt class="MenuRootNodeStyle">Корзина</tt>
        <asp:ScriptManager runat="server" />        
        <asp:UpdatePanel runat="server">
            <ContentTemplate>
                <asp:LinqDataSource ID="CartLinqDataSource" runat="server" ContextTypeName="FlowersStore.FlowerStoreDataContext"
                    EntityTypeName="" OnSelecting="CartLinqDataSource_Selecting" TableName="OrderDetails" >
                </asp:LinqDataSource>
                <asp:ListView ID="lvCart" runat="server" DataSourceID="CartLinqDataSource" OnDataBound="lvCart_DataBound">
                    <EmptyDataTemplate>
                        <table runat="server" style="">
                            <tr>
                                <td>
                                    Ваша корзина пуста
                                </td>
                            </tr>
                        </table>
                    </EmptyDataTemplate>
                    <AlternatingItemTemplate>
                    <tr class="CartTabCell2">
                            <td>
                                <asp:CheckBox runat="server" ID="chbSelect" OnCheckedChanged="chbSelect_CheckedChanged" AutoPostBack="true"  />
                            </td>
                            <td>
                                <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("img") %>' />
                            </td>
                            <td>
                                <asp:Label ID="Order_idLabel" runat="server" Text='<%# Eval("name") %>' />
                            </td>
                            <td>
                                <asp:TextBox ID="TextBoxQuantity" runat="server" Text='<%# Eval("quantity") %>' />
                                <asp:NumericUpDownExtender ID="NumericUpDownExtender" runat="server" Enabled="True"
                                    Maximum="1000" Minimum="1" RefValues="" TargetControlID="TextBoxQuantity" Width="80">
                                </asp:NumericUpDownExtender>
                            </td>
                            <td>
                                <asp:Label ID="ProductLabel" runat="server" Text='<%# ComputeTotalPrice(Eval("price"),Eval("quantity")) %>' />
                            </td>
                            <td>
                                <asp:ImageButton ID="btnDeleteFromCart" runat="server" ImageUrl="~/Styles/Images/edit-delete.png"
                                    AlternateText="Удалить из корзины" OnClick="btnDeleteFromCart_Click" CommandArgument='<%# Eval("id") %>' />
                            </td>
                        </tr>
                    </AlternatingItemTemplate>
                    <ItemTemplate>
                        <tr class="CartTabCell">
                            <td>
                                <asp:CheckBox runat="server" ID="chbSelect" OnCheckedChanged="chbSelect_CheckedChanged"
                                    AutoPostBack="true" />
                            </td>
                            <td>
                                <asp:Image runat="server" ImageUrl='<%# Eval("img") %>' />
                            </td>
                            <td>
                                <asp:Label ID="Order_idLabel" runat="server" Text='<%# Eval("name") %>' />
                            </td>
                            <td>
                                <asp:TextBox ID="TextBoxQuantity" runat="server" Text='<%# Eval("quantity") %>' />
                                <asp:NumericUpDownExtender ID="NumericUpDownExtender" runat="server" Enabled="True"
                                    Maximum="1000" Minimum="1" RefValues="" TargetControlID="TextBoxQuantity" Width="80">
                                </asp:NumericUpDownExtender>
                            </td>
                            <td>
                                <asp:Label ID="ProductLabel" runat="server" Text='<%# ComputeTotalPrice(Eval("price"),Eval("quantity")) %>' />
                            </td>
                            <td>
                                <asp:ImageButton ID="btnDeleteFromCart" runat="server" ImageUrl="~/Styles/Images/edit-delete.png"
                                    AlternateText="Удалить из корзины" OnClick="btnDeleteFromCart_Click" CommandArgument='<%# Eval("id") %>' />
                            </td>
                        </tr>
                    </ItemTemplate>
                    <LayoutTemplate>
                        <table runat="server">
                            <tr runat="server">
                                <td runat="server">
                                    <table id="itemPlaceholderContainer" runat="server" border="0" class="CartTable">
                                        <tr runat="server" class="CartTabTopLineCell">
                                            <th runat="server">
                                                <asp:CheckBox runat="server" ID="chbSelectAll" AutoPostBack="true" OnCheckedChanged="chbSelectAll_CheckedChanged" />
                                                купить все
                                            </th>
                                            <th runat="server">
                                            </th>
                                            <th runat="server">
                                                Товар
                                            </th>
                                            <th runat="server">
                                                Количество
                                            </th>
                                            <th runat="server">
                                                Стоимость, руб.
                                            </th>
                                            <th runat="server">
                                            </th>
                                        </tr>
                                        <tr id="itemPlaceholder" runat="server">
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr runat="server">
                                <th>
                                </th>
                                <th id="Th4" runat="server" class="Sum">
                                    Итого:


                                </th>
                                <th id="Th5" runat="server" class ="ProductPrice">
                                    <asp:Label ID="lblTotalPrice" runat="server" Text="0"/> руб.
                                </th>
                                <th id="Th6" runat="server">
                                </th>
                            </tr>
                            <tr runat="server">
                                <td runat="server">
                                </td>
                            </tr>
                        </table>
                    </LayoutTemplate>
                </asp:ListView>
            </ContentTemplate>
        </asp:UpdatePanel>
        <asp:Button runat="server" ID="btnMakeOrder" Text="Оформить заказ" OnClick="btnMakeOrder_Click" />
    </div>
</asp:Content>
